<?php
use lib\dao\Dao;

class DaoPin extends Dao{
	
	public function load(\lib\model\Model $M){
		$id = $M->token;
	
		if(is_null($id)){
			return;
		}
		$table = get_class($M);
	
		$sql = "SELECT * FROM $table WHERE token = ?";
		$Dar = $this->DataAccess->retrieve($sql, array($id));
		//lo puedo cambiar por un fetch_single para no invocar
		//directamente metodo del padre.
		if($row = $Dar->fetch()){
			foreach($row as $att=>$val){
				$M->$att = $val;
			}
			return true;
		}
		return false;
	}
}